//
//  GroupMemberCreatorTableViewCell.m
//  MyYiJianKangApp
//
//  Created by 张国文 on 16/4/5.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "GroupMemberCreatorTableViewCell.h"

@implementation GroupMemberCreatorTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addMySubview];
    }
    return self;
}

// 布局
- (void)addMySubview
{
    self.friendImageV = [[UIImageView alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, 10 * kAdjustParamater, 50 * kAdjustParamater, 50 * kAdjustParamater)];
    self.friendImageV.backgroundColor = [UIColor redColor];
    self.friendImageV.layer.cornerRadius = 25 * kAdjustParamater;
    [self.contentView addSubview:_friendImageV];
    
    // 创建者
    self.createLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.friendImageV.right + 11 * kAdjustParamater,self.friendImageV.top + 15 * kAdjustParamater, 44 * kAdjustParamater, 20 * kAdjustParamater)];
    self.createLabel.backgroundColor = [UIColor colorWithRed:233 / 255.0 green:138 / 255.0 blue:30 / 255.0 alpha:1];
    self.createLabel.textAlignment = NSTextAlignmentCenter;
    self.createLabel.font = [UIFont systemFontOfSize:k13Big];
    self.createLabel.layer.cornerRadius = 3 * kAdjustParamater;
    self.createLabel.layer.masksToBounds = YES;
    self.createLabel.textColor = [UIColor whiteColor];
    self.createLabel.text = @"创建者";
    [self.contentView addSubview:_createLabel];
    
    self.friendLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.createLabel.right + 6 * kAdjustParamater, self.friendImageV.top + 15 * kAdjustParamater, 100 * kAdjustParamater, 20 * kAdjustParamater)];
   // self.friendLabel.backgroundColor = [UIColor redColor];
    self.friendLabel.textColor = [UIColor blackColor];
    self.friendLabel.textAlignment = NSTextAlignmentLeft;
    self.friendLabel.font = [UIFont systemFontOfSize:k15Big];
    [self.contentView addSubview:_friendLabel];
}

- (void)setModel:(FriendName *)model
{
    self.friendLabel.text = model.name;
    CGRect newFrame = self.friendLabel.frame;
    newFrame.size.width = [[NetStatusHandle shareHandle] adjustWidth:self.friendLabel.text size:k15Big height:20 * kAdjustParamater];
    self.friendLabel.frame = newFrame;
}

@end
